function [res] = summary_func(M)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% This function computes summary statistics for each variable.
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Inputs:
	% M:				NumObs x NumVars
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Outputs:
	% res:				table of dimensions NumVars x 10
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	NumVars = size(M,2);
	mysummary = zeros(NumVars, 10);
	for ii = 1:NumVars
		u = M(:,ii);
		mysummary(ii,:) = [nanmin(u), quantile(u, 0.25), quantile(u, 0.5), nanmean(u), quantile(u, 0.75), nanmax(u), nanstd(u), nansum(u), length(u), sum(isnan(u))];
	end
	res = array2table(mysummary);
	res.Properties.VariableNames = {'Min' 'Pct25' 'Median' 'Mean' 'Pct75' 'Max', 'StdDev', 'Sum', 'N', 'NumNaNs'};
end